import http from '@/utils/http'

export function userListReq() {
  return http<IResData<Array<IUserItem>>>({
    url: '/admin/admin/list',
    method: 'get',
  })
}

export function userDelReq(adminid: string) {
  return http<IResData<unknown>>({
    url: '/admin/admin/delete',
    method: 'post',
    data: { adminid },
  })
}

export function userAddReq(adminname: string, password: string, role: number) {
  return http<IResData<unknown>>({
    url: '/admin/admin/add',
    method: 'post',
    data: { adminname, password, role, checkedKeys: [] },
  })
}

export function userInfoReq() {
  const adminname = localStorage.getItem('xxMallAdminName')
  return http<IResData<IUserItem>>({
    url: '/admin/admin/detail',
    method: 'get',
    params: { adminname },
  })
}
